function sleep (fn, millSeconds,params) {
    return new Promise((resolve) => {
        // wait before calling fn(par)
        if(Array.isArray(params)){
            setTimeout(() => resolve(fn(...params)), millSeconds);
        }else{
            setTimeout(() => resolve(fn(params)), millSeconds);
        }
    })
}

export default{
    sleep
}